//
//  QHCommonTool.h
//  QHealthForDoctor
//
//  Created by 李志良 on 16/9/7.
//  Copyright © 2016年 李 志良. All rights reserved.
//

#import <Foundation/Foundation.h>

#import "KeychainItemWrapper.h"
#import "ASHYKeyChain.h"
#import "TimeTool.h"
#import <AVFoundation/AVFoundation.h>

typedef void (^UploadFileSuccessBlock)(NSString * fileURL);

typedef void (^CheckHasUnReadMessageBlock)(BOOL hasUnRead);

@class UserModel;
@interface QHCommonTool : NSObject

//json转字典
+ (NSDictionary *)dictionaryWithJsonString:(NSString *)jsonString;
//字典数组转json
+(NSString*)dictionaryTOjsonString:(id)object;

+(NSString*)dictionaryTOjsonStringOrdered:(id)object;

// 字典转 xwwwform 格式字符串
+(NSString *)dictionaryToxwwwFormUrlencoded:(id)object;

+(NSString *)returnJsonstringwithObject:(id)aObject;

//根据字符串和文字字体以及label宽度计算高度
+(float)caculateTheFormRowHeightWithLabelString:(NSString*)LabelString LabelTextFontSize:(float)TextFontSize LabelWidth:(float)LabelWidth;

+(void)upLoadFileWithURL:(NSString*)aURL ParamDic:(NSDictionary*)paramDic Image:(UIImage*)aImage;
+(void)upLoadFileWithURL2:(NSString*)aURL ParamDic:(NSDictionary*)paramDic Image:(UIImage*)aImage UploadSuccessBlock:(UploadFileSuccessBlock)block;
+(NSString *) utf8ToUnicode:(NSString *)string;
+ (NSString*) replaceUnicode:(NSString*)aUnicodeString;

//还原CID
+(NSString*)reductionCIDWithDecodeCID:(NSString*)DecodeCID;

+(void)saveSomeData;
+(void)deleteUserInfo;
//+(void)saveUnreadNotificationEntity:(PushNotification_Entity*)notificationEntity;
+ (NSArray*)fetchUnReadNotifications;

+(NSString*)getDeviceID;
+(NSString*)getSystemVersion;
+(NSString*)getPhoneType;
+ (UIViewController *)getPresentedViewController;

+(void)messageHasUnRead:(CheckHasUnReadMessageBlock)checkHasUnReadMessageBlock;

+(void)saveEnterBackgroundTime;
+(BOOL)isCrossTheMidNight;

// 视频格式转换

+(NSURL *)videoConvertToMp4:(NSURL *)movUrl;

+(NSURL *)ConvertToMp4:(NSURL *)movUrl WithAsset:(AVAsset *)asset;

+(UserModel *)getUserInfoWithIDNumber:(NSString *)idNumber;

+(NSArray *)getCommonBanks;

+(NSInteger)getRamdomNumberUnder:(NSInteger)max noNumber:(NSInteger)num;

@end
